package com.jiulong.common.utils;

import com.alibaba.fastjson.JSONObject;

public class getAccount {

    public static void main(String[] args) {
        String openid = "ohx_wwiIXSM7yFNDcaLymiMeIh8o";
        String access_token = "eAjEOJPzDjdHGPzUz-2usiYyAuHxD8AeVnjHxM-PHruo6V9usNimN-kR_tTW2BV_EIJK_U0_yBFJENtaDXXxKvcivh-ayFcwwTvyXBNtTlU";
        String url = " 	https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid;
        System.out.println(url);
        String resXml = HttpUtil.postData(url, null);
        System.out.println("返回xml：：：：" + resXml);
        JSONObject j = JSONObject.parseObject(resXml);
        System.out.println(j);
        System.out.println(j.get("headimgurl"));
        String headimgurl = j.get("headimgurl").toString();
        String nickname = j.get("nickname").toString();
        System.out.println(j.get("nickname"));
    }

    public static JSONObject weixin_payGetAccount(String openid) {

        //String openid="ohx_wwiIXSM7yFNDcaLymiMeIh8o";
        String access_token = "eAjEOJPzDjdHGPzUz-2usiYyAuHxD8AeVnjHxM-PHruo6V9usNimN-kR_tTW2BV_EIJK_U0_yBFJENtaDXXxKvcivh-ayFcwwTvyXBNtTlU";
        String url = " 	https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid;
        System.out.println(url);
        String resXml = HttpUtil.postData(url, null);
        System.out.println("返回xml：：：：" + resXml);
        JSONObject j = JSONObject.parseObject(resXml);
        System.out.println(j);
        System.out.println(j.get("headimgurl"));
        String headimgurl = j.get("headimgurl").toString();
        String nickname = j.get("nickname").toString();
        System.out.println(j.get("nickname"));

        return j;

    }

}
